package com.aier.admin.action;

import java.io.File;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.aier.admin.common.AdminExcelUtil;
import com.aier.admin.service.IAdminICService;

@Scope("prototype")
@Component("adminICWriteAction")
public class AdminICWriteAction extends AdminBaseAction {

    /**
     * 
     */
    private static final long serialVersionUID = 1L;
    
    private File file;
    @SuppressWarnings("unused")
    private String fileFileName;
    private String fileContentType;
    
    @Resource(name="adminICService")
    private IAdminICService adminICService;
    private int s;
    
    /**
     * 进入
     */
    @Override
    public String execute(){
        return SUCCESS;
    }
    
    /**
     * 上传文件
     * @return
     */
    public String upfile(){
        s=adminICService.insertICWrite(AdminExcelUtil.parseExcel(file,fileContentType,
                AdminExcelUtil.TYPE_DEFAULT),AdminExcelUtil.TYPE_DEFAULT);
        return SUCCESS;
    }
    
    public String w(){
        
        return SUCCESS;
    }

    public int getS() {
        return s;
    }

    public void setFile(File file) {
        this.file = file;
    }

    public void setFileFileName(String fileFileName) {
        this.fileFileName = fileFileName;
    }

    public void setFileContentType(String fileContentType) {
        this.fileContentType = fileContentType;
    }

    public void setAdminICService(IAdminICService adminICService) {
        this.adminICService = adminICService;
    }

}
